import json
import os
basic_path = str(os.path.dirname(__file__)) + "\\"
job_json_path = basic_path + "..\\..\\school_job\\school_job_detail.json"


with open(job_json_path, 'r', encoding='utf-8') as f:
    data = json.load(f)

# 现在，data 是一个包含 JSON 数据的字典或列表

json_update = {}

for key, value in data.items():
    print(key)
    json_update[key] = {}
    if value['attr'] != "":
        for key1, value1 in value['attr'].items():
            json_update[key][key1] = float(value1)

# 打开一个文件并写入 JSON 数据
with open('json/schoolJobWhere.json', 'w', encoding='utf-8') as f:
    json.dump(json_update, f, ensure_ascii=False, indent=4)
